﻿module JsAst


type Expression = 
    | StringLiteral of string
    | NumberLiteral of float
    | NullLiteral
    | BooleanLiteral of bool
    | Name of string
    (* espressions *)
    | PropertyExpression of Expression*string
    | CallExpression of Expression*Arguments
    | BinaryOperation of string * Expression * Expression
    | PostfixMutate of string * Expression
    | PrefixMutate of string * Expression
    | UnaryOperation of string * Expression
    | NewExpression of Expression * Arguments
    | BracketsExpression of Expression * Expression
    | AssignmentExpression of Expression * Expression
    | CompoundAssignmentExpression of string * Expression * Expression
    | PostfixOperation of string * Expression
    | ConditionalOperation of Expression*Expression*Expression
    | FunctionExpression of Parameters*Statements
and Arguments = Expression list
and Parameters = string list
and Statements = Statement list
and Statement = 
    | FunctionDeclaration of string * Parameters * Statements
    | ExpressionStatement of Expression
    | VariableStatement of (string * Expression option) list
    | ReturnStatement of Expression option
    | IfStatement of Expression * Statements
    | IfElseStatement of Expression * Statements * Statements
